package org.lagou.edu.controller.command;

import com.google.gson.GsonBuilder;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
import org.elasticsearch.search.sort.FieldSortBuilder;

/**
 * 列表查询入参
 *
 * @author sunxin
 */

public class ListResponseRequest {

    /**
     * 搜索字段
     */
    private BoolQueryBuilder queryBuilder;

    /**
     * index
     */
    private String index;

    /**
     * type
     */
    private String type;

    /**
     * 排序
     */
    private FieldSortBuilder sortBuilder;

    /**
     * 分组
     */
    private TermsAggregationBuilder aggs;

    @Override
    public String toString() {
        return new GsonBuilder().serializeNulls().create().toJson(this);
    }

    public BoolQueryBuilder getQueryBuilder() {
        return queryBuilder;
    }

    public void setQueryBuilder(BoolQueryBuilder queryBuilder) {
        this.queryBuilder = queryBuilder;
    }

    public String getIndex() {
        return index;
    }

    public void setIndex(String index) {
        this.index = index;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public FieldSortBuilder getSortBuilder() {
        return sortBuilder;
    }

    public void setSortBuilder(FieldSortBuilder sortBuilder) {
        this.sortBuilder = sortBuilder;
    }

    public TermsAggregationBuilder getAggs() {
        return aggs;
    }

    public void setAggs(TermsAggregationBuilder aggs) {
        this.aggs = aggs;
    }
}

